<?php 
namespace Users\Factory\Model;
 
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Db\TableGateway\TableGateway;
use Users\Model\UsersnewTable;
use Users\Model\Usersnew;
use Zend\Stdlib\Hydrator\ObjectProperty;
use Zend\Db\ResultSet\HydratingResultSet;
use Album\Factory\Model\SlaveAdapter;
use Zend\Db\TableGateway\Feature;
 
class UsersNewTableFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $db = $serviceLocator->get('Zend\Db\Adapter\Adapter'); 
        $resultSetPrototype = new HydratingResultSet();
        $resultSetPrototype->setHydrator(new ObjectProperty());
        $resultSetPrototype->setObjectPrototype(new usersnew()); 
        $tableGateway       = new TableGateway('users_new', $db, array(), $resultSetPrototype);
        $table              = new usersnewTable($tableGateway); 
        return $table;
    }
}